//
//  ImagesManager.m
//  KiklinkApp
//
//  Created by LJC on 14-9-2.
//  Copyright (c) 2014年 Kiklink. All rights reserved.
//

#import "ImagesManager.h"

#define tabItemPngScale 0.35
#define sliderPngScale 0.5

@implementation ImagesManager

+ (ImagesManager *)sharedImagesManager
{
    static ImagesManager *sharedImagesManagerInstance = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedImagesManagerInstance = [[self alloc] init];
    });
    return sharedImagesManagerInstance;
}

- (UIImage *)changeImage:(UIImage *)image ToScale:(CGFloat)scale
{
    CGSize size = CGSizeMake(image.size.width * scale, image.size.height * scale);
    
    // 创建一个bitmap的context
    // 并把它设置成为当前正在使用的context
    UIGraphicsBeginImageContext(size);
    
    // 绘制改变大小的图片
    [image drawInRect:CGRectMake(0, 0, size.width, size.height)];
    
    // 从当前context中创建一个改变大小后的图片
    UIImage* scaledImage = UIGraphicsGetImageFromCurrentImageContext();
    
    // 使当前的context出堆栈
    UIGraphicsEndImageContext();
    
    // 返回新的改变大小后的图片
    return scaledImage;
}

/*
 index = 0，首页
 index = 1，精选
 index = 2，附近
 index = 3，我
 */
- (UIImage *)tabItemOfIndex:(NSInteger)index selected:(BOOL)selected
{
    UIImage *image;
    
    if (index == 0 && selected == YES) {
        image = [UIImage imageNamed:@"homeSelected.png"];
    } else if (index == 0 && selected == NO) {
        image = [UIImage imageNamed:@"home.png"];
    } else if (index == 1 && selected == YES) {
        image = [UIImage imageNamed:@"chosenSelected.png"];
    } else if (index == 1 && selected == NO) {
        image = [UIImage imageNamed:@"chosen.png"];
    } else if (index == 2 && selected == YES) {
        image = [UIImage imageNamed:@"localSelected.png"];
    } else if (index == 2 && selected == NO) {
        image = [UIImage imageNamed:@"local.png"];
    } else if (index == 3 && selected == YES) {
        image = [UIImage imageNamed:@"meSelected.png"];
    } else if (index == 3 && selected == NO) {
        image = [UIImage imageNamed:@"me.png"];
    }
    
//    image = [self changeImage:image ToScale:tabItemPngScale];
    
    return image;
}

- (UIImage *)logo
{
    UIImage *image = [UIImage imageNamed:@"logo.png"];
    return image;
}

- (UIImage *)back
{
    UIImage *image = [UIImage imageNamed:@"back.png"];
    return image;
}

- (UIImage *)backTapped
{
    UIImage *image = [UIImage imageNamed:@"backTapped.png"];
    return image;
}

- (UIImage *)findLocal
{
    UIImage *image = [UIImage imageNamed:@"findLocal.png"];
    return image;
}

- (UIImage *)recommendLabel
{
    UIImage *image = [UIImage imageNamed:@"recommendLabel.png"];
    return image;
}

- (UIImage *)filter
{
    UIImage *image = [UIImage imageNamed:@"filter.png"];
    return image;
}

- (UIImage *)filterTapped
{
    UIImage *image = [UIImage imageNamed:@"filterTapped.png"];
    return image;
}

- (UIImage *)slider
{
    UIImage *image = [UIImage imageNamed:@"slider.png"];
    image = [self changeImage:image ToScale:sliderPngScale];
    return image;
}

- (UIImage *)sliderTapped
{
    UIImage *image = [UIImage imageNamed:@"sliderTapped.png"];
    image = [self changeImage:image ToScale:sliderPngScale];
    return image;
}

- (UIImage *)sliderBackGround
{
    UIImage *image = [UIImage imageNamed:@"sliderBackGround.png"];
    return image;
}

- (UIImage *)sliderFar
{
    UIImage *image = [UIImage imageNamed:@"sliderFar.png"];
    return image;
}

- (UIImage *)sliderNear
{
    UIImage *image = [UIImage imageNamed:@"sliderNear.png"];
    return image;
}

- (UIImage *)message
{
    UIImage *image = [UIImage imageNamed:@"message.png"];
    return image;
}

- (UIImage *)messageTapped
{
    UIImage *image = [UIImage imageNamed:@"messageTapped.png"];
    return image;
}

- (UIImage *)settings
{
    UIImage *image = [UIImage imageNamed:@"settings.png"];
    return image;
}

- (UIImage *)settingsTapped
{
    UIImage *image = [UIImage imageNamed:@"settingsTapped.png"];
    return image;
}

- (UIImage *)loginBackGround
{
    UIImage *image = [UIImage imageNamed:@"loginBackGround.png"];
    return image;
}

- (UIImage *)portrait
{
    UIImage *image = [UIImage imageNamed:@"portrait.png"];
    return image;
}

- (UIImage *)portraitOutline
{
    UIImage *image = [UIImage imageNamed:@"portraitOutline.png"];
    return image;
}

- (UIImage *)unpay
{
    UIImage *image = [UIImage imageNamed:@"unpay.png"];
    return image;
}

- (UIImage *)paylist
{
    UIImage *image = [UIImage imageNamed:@"paylist.png"];
    return image;
}

- (UIImage *)evaluate
{
    UIImage *image = [UIImage imageNamed:@"evaluate.png"];
    return image;
}

- (UIImage *)allPayList
{
    UIImage *image = [UIImage imageNamed:@"allPayList.png"];
    return image;
}

- (UIImage *)collection
{
    UIImage *image = [UIImage imageNamed:@"collection.png"];
    return image;
}

- (UIImage *)coupon
{
    UIImage *image = [UIImage imageNamed:@"coupon.png"];
    return image;
}

- (UIImage *)share
{
    UIImage *image = [UIImage imageNamed:@"share.png"];
    return image;
}

- (UIImage *)shareTapped
{
    UIImage *image = [UIImage imageNamed:@"shareTapped.png"];
    return image;
}

- (UIImage *)unCollected
{
    UIImage *image = [UIImage imageNamed:@"unCollected.png"];
    return image;
}

- (UIImage *)collected
{
    UIImage *image = [UIImage imageNamed:@"collected.png"];
    return image;
}

- (UIImage *)expand
{
    UIImage *image = [UIImage imageNamed:@"expand.png"];
    return image;
}

- (UIImage *)shrink
{
    UIImage *image = [UIImage imageNamed:@"shrink.png"];
    return image;
}

- (UIImage *)phone
{
    UIImage *image = [UIImage imageNamed:@"phone.png"];
    return image;
}

- (UIImage *)phoneTapped
{
    UIImage *image = [UIImage imageNamed:@"phoneTapped.png"];
    return image;
}

- (UIImage *)push
{
    UIImage *image = [UIImage imageNamed:@"push.png"];
    return image;
}

-(UIImage *)remarkPortrait;
{
    UIImage *image = [UIImage imageNamed:@"remarkPortrait.png"];
    return image;
}

- (UIImage *)starHighlight
{
    UIImage *image = [UIImage imageNamed:@"starHighlight.png"];
    return image;
}

- (UIImage *)star
{
    UIImage *image = [UIImage imageNamed:@"star.png"];
    return image;
}

- (UIImage *)couponEdge
{
    UIImage *image = [UIImage imageNamed:@"couponEdge.png"];
    return image;
}

- (UIImage *)about
{
    UIImage *image = [UIImage imageNamed:@"about.png"];
    return image;
}

- (UIImage *)favourable
{
    UIImage *image = [UIImage imageNamed:@"favourable.png"];
    return image;
}

- (UIImage *)feedBack
{
    UIImage *image = [UIImage imageNamed:@"feedBack.png"];
    return image;
}

- (UIImage *)sharing
{
    UIImage *image = [UIImage imageNamed:@"sharing.png"];
    return image;
}

- (UIImage *)update
{
    UIImage *image = [UIImage imageNamed:@"update.png"];
    return image;
}

- (UIImage *)alipay
{
    UIImage *image = [UIImage imageNamed:@"alipay.png"];
    return image;
}

- (UIImage *)unionPay
{
    UIImage *image = [UIImage imageNamed:@"unionPay.png"];
    return image;
}

- (UIImage *)weChat
{
    UIImage *image = [UIImage imageNamed:@"weChat.png"];
    return image;
}

- (UIImage *)check
{
    UIImage *image = [UIImage imageNamed:@"check.png"];
    return image;
}

- (UIImage *)unCheck
{
    UIImage *image = [UIImage imageNamed:@"unCheck.png"];
    return image;
}

- (UIImage *)paySuccess
{
    UIImage *image = [UIImage imageNamed:@"paySuccess.png"];
    return image;
}

- (UIImage *)grayStar
{
    UIImage *image = [UIImage imageNamed:@"grayStar.png"];
    return image;
}

- (UIImage *)yellowStar
{
    UIImage *image = [UIImage imageNamed:@"yellowStar.png"];
    return image;
}

- (UIImage *)noCollection
{
    UIImage *image = [UIImage imageNamed:@"noCollection.png"];
    return image;
}

- (UIImage *)noOrder
{
    UIImage *image = [UIImage imageNamed:@"noOrder.png"];
    return image;
}

@end
